package com.hurui.xiaoming.weight;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.hurui.xiaoming.R;
import com.hurui.xiaoming.utils.DisplayParams;
import com.hurui.xiaoming.utils.DisplayUtil;

/**
 * Created by hurui on 2017/7/22.
 */

public class PullDownView extends LinearLayout {
    private DisplayParams displayparams ;
    private View childView ; //整个布局
    private ImageView la_view  ;


    //获取屏幕的一些参数
    private int screenHeight; //屏幕的高度
    private int screenWidth ; //屏幕的宽度

    public PullDownView(Context context) {
        super(context);
    }

    public PullDownView(Context context, AttributeSet attrs) {
        super(context, attrs);
        displayparams = DisplayParams.getInstance(context);
        screenWidth = displayparams.screenWidth;
        screenHeight = displayparams.screenHeight;
        initView();
    }


    //将布局添加进去
    private void initView(){
        childView = LayoutInflater.from(getContext()).inflate(R.layout.pull_down_view , this , false);
        childView.setY(-screenHeight + DisplayUtil.dip2px(60 , displayparams.fontScale));
        la_view = (ImageView) childView.findViewById(R.id.la_view);
        addView(childView);
    }


}
